<template>
	<view class="flex flex-column bg-white">
		<image class="rounded-lg bg-white" style="width: 100%;height: 500rpx;" :src="companyData.merchant_img"
			mode="aspectFill">
		</image>
		<view class="text-center fs-40 font-weight-bold my-3">{{companyData.merchant_name}}</view>
		<view class="rounded-lg p-2 border mx-3 fs-32 bg-linear1 boxshadow border text-white"
			@click="navTo('/pages/store/entry')">
			<view class="flex align-center justify-between ">
				<text class="text-white">公司名称</text>
				<text class="">{{companyData.company_name}}</text>
			</view>
			<view class="flex align-center justify-between my-3">
				<text class="">经营范围</text>
				<text class="">{{companyData.business_list}}</text>
			</view>
			<view class="flex align-center justify-between my-3" v-if="companyData.create_time">
				<text class="">注册时间</text>
				<text class="">{{unixToDate((companyData.create_time || 0) * 1000)}}</text>
			</view>
			<view class="text-center py-1 rounded-circle bg-white fte87722 " v-if="companyData.create_time">
				查看详情
			</view>
		</view>
		<!--#ifndef H5-->
		<view
			class="rounded border px-3 py-2 bde87722 bg-linear1 text-white flex align-center justify-center text-center mt-4 mx-3  box-sizing"
			@click="scan()">
			<uni-icons type="scan" size="20" color="#fff"></uni-icons>
			<text class="fs-32 ml-1">扫码</text>
		</view>
		<!--#endif-->
		<view class="flex flex-wrap mx-3 grid2">
			<view
				class="rounded border px-3 py-1 bde87722 fte87722 flex flex-column justify-center text-center mt-4  box-sizing"
				@click="navTo('/pages/store/createGoods')">
				<uni-icons class="mx-auto " type="plusempty" size="30" color="#e87722"></uni-icons>
				<text class="fs-32">创建商品</text>
			</view>
			<view
				class="rounded border px-3 py-1 bde87722 fte87722 flex flex-column justify-center text-center  mt-4  box-sizing"
				@click="navTo('/pages/store/goodsManage')">
				<uni-icons class="mx-auto " type="gear" size="30" color="#e87722"></uni-icons>
				<text class="fs-32">商品管理</text>
			</view>
			<view
				class="rounded border px-3 py-1 bde87722 fte87722 flex flex-column justify-center text-center  mt-4  box-sizing "
				@click="navTo('/pages/store/order?status=0')">
				<uni-icons class="mx-auto " type="list" size="30" color="#e87722"></uni-icons>
				<text class="fs-32">订单管理</text>
			</view>
			<view
				class="rounded border px-3 py-1 bde87722 fte87722 flex flex-column justify-center text-center  mt-4  box-sizing "
				@click="navTo('/pages/store/moneyLogList')">
				<uni-icons class="mx-auto " type="wallet" size="30" color="#e87722"></uni-icons>
				<text class="fs-32">流水记录</text>
			</view>
			<view
				class="rounded border px-3 py-1 bde87722 fte87722 flex flex-column justify-center text-center  mt-4  box-sizing "
				@click="navTo('/pages/store/withdrawal')">
				<uni-icons class="mx-auto " type="upload" size="30" color="#e87722"></uni-icons>
				<text class="fs-32">提现</text>
			</view>
			<view
				class="rounded border px-3 py-1 bde87722 fte87722 flex flex-column justify-center text-center  mt-4  box-sizing "
				@click="navTo('/pages/store/withdrawalOrder')">
				<uni-icons class="mx-auto " type="bars" size="30" color="#e87722"></uni-icons>
				<text class="fs-32">提现订单</text>
			</view>
		</view>

		<view style="height: 40px;"></view>
	</view>
</template>

<script>
	import {
		merchantManageauditStatus,
		merchantManageinfo,
		merchantManageapply,
		merchantManageinfoedit
	} from "@/api/entry";
	import {
		unixToDate
	} from '@/utils/Foundation.js'
	export default {
		data() {
			return {
				unixToDate,
				companyData: {}
			}
		},
		created() {
			this.merchantManageinfo()
		},
		methods: {
			merchantManageinfo() {
				merchantManageinfo().then(res => {
					if (res.data) {
						this.companyData = res.data.merchant
					}
				})
			},
			/**
			 * 唤醒客户端扫码
			 * 没权限去申请权限，有权限获取扫码功能
			 */
			async scan() {
				// #ifndef H5
				this.scanCode();
				// #endif
			},
			/**
			 * TODO 扫码功能后续还会后续增加
			 */
			scanCode() {
				uni.scanCode({
					success: function(res) {
						console.log('scanCode------', res)
						const arr = res.result.split('&')
						uni.navigateTo({
							url: `/pages/store/scanCodeInfo?sn=${arr[0]}&type=${arr[1]}`
						});
					},
				});
			},
			navTo(url) {
				uni.navigateTo({
					url
				})
			},
		}
	}
</script>

<style lang="scss">

</style>